<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f() {
            var zfc = document.getElementById('a').value;
            document.getElementById('s').innerHTML = "还能输入:"+(500-zfc.length)+"字";
        }
    </script>
</head>
<body>
    自我介绍:
    <br>
    <textarea  id="a" maxlength="500" style="height: 100px;width: 300px" onkeyup="f()"></textarea>
    <br>
    <span id="s">还能输入:500字</span>
</body>
</html>